package com.example.xyblog.Common;

import java.util.HashMap;

public class AjaxRespons {
    public static HashMap success(Object data, String msg) {
        HashMap<String, Object> result = new HashMap<>();
        result.put("code", 200);
        result.put("data", data);
        result.put("msg", msg);
        return result;
    }

    public static HashMap success(Object data) {
        HashMap<String, Object> result = new HashMap<>();
        result.put("code", 200);
        result.put("data", data);
        result.put("msg", "");
        return result;
    }

    public static HashMap fail(int code, Object data, String msg) {
        HashMap<String, Object> result = new HashMap<>();
        result.put("code", code);
        result.put("data", data);
        result.put("msg", msg);
        return result;
    }

    public static HashMap fail(int code,String msg) {
        HashMap<String, Object> result = new HashMap<>();
        result.put("code", code);
        result.put("data", "");
        result.put("msg", msg);
        return result;
    }

    public static HashMap fail(int code, Object data) {
        HashMap<String, Object> result = new HashMap<>();
        result.put("code", code);
        result.put("data", data);
        result.put("msg", "");
        return result;
    }

}
